import betterScroll from "better-scroll";

const scroll = ({
    el,
    getdata
}) => {
   let scroll = new betterScroll(el, {
        probeType: 2,
        click:true,
        pullUpLoad: {
            threshold: 50
        }
    });

    scroll.on('pullingUp', () => {
        getdata();

        // 当上啦加载完毕后要告诉scroll
        scroll.finishPullUp()
        // 更新数据后重新计算scroll
        scroll.refresh();
    });
}

export default scroll;